Print the length of the seriesΒΆ
Print the length of the series and the series from the given
3rd term, 3rd last term and the sum of a series.
Input data:
3rd term - 3
3rd last term - 118 55
Sum of the series - 91
tn = int(input("Input third term of the series:"))
tltn = int(input("Input 3rd last term:"))
s_sum = int(input("Sum of the series:"))
n = int(2*s_sum/(tn+tltn))
print("Length of the series: ",n)
d = (tltn-tn)/(n-5)
a = tn-2*d
j = 0
print("Series:")
for j in range(n-1):
print(int(a), end=" ")
a += d
print(int(a),end=" ")
Output:
Input third term of the series: 3
Input 3rd last term: 118
Sum of the series: 91
Length of the series: 1
Series:
60